package jxerializeml.xml.transformers;

import jxerializeml.xml.FieldBean;
import jxerializeml.xml.NodeBean;

/**
 * <p>
 *   Used during serialization.
 * </p>
 * <p>
 *   It transforms informations about items to the node beans,
 *   which will be directly copied to the XML document. It means,
 *   that implementation of this class will be responsible for
 *   the tag name and all attributes.
 * </p>
 * 
 * @author Tomáš Zíma
 */
public interface OutTransformer {
	/**
	 * Transforms informations about single field to the node bean.
	 * Usually, it will copy name of the field, name of the class and
	 * also the value in the case of primitive types.
	 * 
	 * @param fieldBean
	 *     All informations about the field.
	 *   
	 * @return
	 *     NodeBean with tag name and all attributes.
	 */
	NodeBean transformField(FieldBean fieldBean);
	
	/**
	 * Transforms informations about the serialized object to the
	 * node bean. Because the only usable information here is the
	 * class name, it doesn't need any complex bean. 
	 * 
	 * @param className
	 *     Name of the class of the serialized object.
	 *   
	 * @return
	 *     NodeBean with tag name and all attributes.
	 */
	NodeBean transformRoot(String className);
	
	/**
	 * Transforms informations about one item of the array to
	 * the node bean.
	 * 
	 * @param fieldBean
	 *     All informations about the array item. In this case,
	 *     "name" means the index and type might be empty.
	 *    
	 * @return
	 *     NodeBean with tag name and all attributes.
	 */
	NodeBean transformArrayItem(FieldBean fieldBean);
}
